-- Create table '{{ table.name }}'
CREATE TABLE{{ " IF NOT EXISTS" if ifNotExists }} `{{ table.name }}` (
{% for column in table.columns %}
  {{ "  " if loop.index == 1 else ", " }}`{{ column.name }}` {{ column.type }}{{ " NOT NULL" if not column.nullable }}{{ " DEFAULT " + column.default if column.default }}{{ " COMMENT " + (column | getComment | toSQL) if withComment and (column | getComment) }}
{% endfor %}
{% if table.primaryKey %}
  , PRIMARY KEY ({{ table.primaryKey.columns }})
{% endif %}
{% for index in table.indexes %}
  , {{ "UNIQUE " if index.unique }}KEY `{{ index.name }}` ({{ index.columns }})
{% endfor %}
){{ " ENGINE=" + table.engine if table.engine }}{{ " AUTO_INCREMENT=" + table.autoIncrement if table.autoIncrement and table.autoIncrement !== 1 }}{{ " DEFAULT CHARSET=" + table.characterSet if table.characterSet }}{{ " COMMENT=" + (table.comment | toSQL) if withComment and table.comment }};